package com.huxiu.holder;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.huxiu.BaseActivity;
import com.huxiu.R;
import com.huxiu.SubmitCommentActivity;
import com.huxiu.net.GsonRequest;
import com.huxiu.net.NetworkConstants;
import com.huxiu.net.model.CommentItem;
import com.huxiu.net.responses.TuiJianDataResponse;
import com.huxiu.utils.Constants;
import com.huxiu.utils.ErrorResponseException;
import com.huxiu.utils.ImageLoaderOptions;
import com.huxiu.utils.Settings;
import com.huxiu.utils.Utils;
import com.huxiu.view.MyListView;
import com.huxiu.view.RoundImageView;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;


public class ReplyHolder implements OnClickListener {
    @ViewInject(R.id.container)
    private LinearLayout container;

    @ViewInject(R.id.avatar)
    private RoundImageView avatar;

    @ViewInject(R.id.name)
    private TextView name;

    @ViewInject(R.id.content)
    private TextView content;

    @ViewInject(R.id.time)
    private TextView time;


    private static Activity mContext;

    private static WeakReference<BaseAdapter> mAdapter;

    public void setAdapter(BaseAdapter adapter) {
        mAdapter = new WeakReference<>(adapter);
    }
    public ReplyHolder(View view, Context context) {
        ViewUtils.inject(this, view);
        mContext = (Activity) context;

    }
    private CommentItem.Recomment mItem;
    public void bindItem(CommentItem.Recomment mRecomment){
        mItem =mRecomment;
        name.setText(mItem.author);
        Log.e("reply", "2222");
        content.setText(mItem.comment);
        time.setText(Utils.getDateString(mItem.dateline));
        ImageLoader.getInstance().displayImage(
                mItem.avatar+Constants.IMAGE_WEBP, avatar, ImageLoaderOptions.options);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.huifu:

                break;
            case R.id.text_disagree:
                if(!Settings.isLoggedIn()) {
                    Utils.askLogIn(mContext);
                    return;
                }

                break;
            case R.id.text_agree:
                if (!Settings.isLoggedIn()) {
                    Utils.askLogIn(mContext);
                    return;
                }

                break;
        }
    }









}
